<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="">
  	<title>个人资料</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
<link href="../../css/mokstyle.css" rel="stylesheet" type="text/css">
		<style type="text/css">
		a:link {text-decoration: none;}
		a:visited {text-decoration: none;}
		a:active {text-decoration: none;}
		a:hover {text-decoration:underline;padding-bottom:8px;border-bottom:1 solid black}
		
		</style> 
		<script type="text/javascript">
			function init(){
				if("${pwdmessage}"!=""){
					document.getElementById('pwd0').value = '';
					alert("${pwdmessage}");
					change('pwd')
					return;
				}else if("${compmessage}"!=""){
					alert("${compmessage}");
					change('companyinfo')
					return;
				}
			}
		
			function change(id){
				document.getElementById('pwd0').value = '';
				
				var a = document.getElementsByName('a');
				var fom = document.getElementsByName('fom');
				for(var i=0;i<3;i++){
					a[i].style.textDecoration = 'none';
					fom[i].style.display = 'none';
				}
				document.getElementById(id).style.display = 'block';
				document.getElementById(id+'a').style.textDecoration = 'underline';
				return;
			}
			function onupdate(){
				var val = document.getElementById('button1').value;
				if(val=='修改'){
					document.getElementById('info1').readOnly = false;
					document.getElementById('info2').readOnly = false;
					document.getElementById('info3').readOnly = false;
					document.getElementById('info4').readOnly = false;
					document.getElementById('info1').className="";
					document.getElementById('info2').className="";
					document.getElementById('info3').className="";
					document.getElementById('info4').className="";
					
					document.getElementById('button1').value = '保存';
				}else{
					document.getElementById('info1').readOnly = true;
					document.getElementById('info2').readOnly = true;
					document.getElementById('info3').readOnly = true;
					document.getElementById('info4').readOnly = true;
					document.getElementById('info1').className="contact_input";
					document.getElementById('info2').className="contact_input";
					document.getElementById('info3').className="contact_input";
					document.getElementById('info4').className="contact_input";
					document.getElementById('button1').value = '修改';
					document.getElementById('infoForm').submit();
				}
			}
			
			function updatePwd(){
				var pwd0 = document.getElementById('pwd0').value;
				var pwd1 = document.getElementById('pwd1').value;
				var pwd2 = document.getElementById('pwd2').value;
				if(pwd0==''){
					alert("旧密码不能为空！")
					return;
				}
				if(pwd1==''){
					alert("新密码不能为空！")
					return;
				}
				if(pwd1!=pwd2){
					alert("新密码输入不一致，请重输。")
					document.getElementById('pwd1').value = '';
					document.getElementById('pwd2').value = '';
					return;
				}
				document.getElementById('pwdForm').submit();
			}
			
			function updatecompany(){
				var name = document.getElementById('companyname').value;
				var add = document.getElementById('companyadd').value;
				if(name==''){
					alert("公司名称不能为空！")
					return;
				}
				if(add==''){
					alert("公司地址不能为空！")
					return;
				}
				document.getElementById('companyForm').submit();
			}
		</script>

	</head>
  
  
  <body onload="init()">
  
<div  id="wrap">
 	<div class="header">
       		<div class="logo"><a href="/aasimp/mok/maintenance/index_getMtInfo"><img src="../../images/logo.gif" alt="" title="" border="0" /></a></div>            
        <div id="menu">
            <ul>                                                                       
            <li><a href="/aasimp/mok/maintenance/index_getMtInfo">首页</a></li>
            <li class="selected"><a href="/aasimp/mok/maintenance/info_getcompany">个人资料</a></li>
            <li><a href="/aasimp/mok/maintenance/odd_getOdd" >维修申请</a></li>
            <li><a href="/aasimp/mok/maintenance/approve_showApprove">审批维修</a></li>
            <li><a href="/aasimp/mok/maintenance/mt_showmts">维修记录</a></li>
            <li><a href="sendInfo.jsp">信息发布</a></li>
            <li><a href="/aasimp/mok/maintenance/report_showMtReport">报表统计</a></li>
            </ul>
        </div>  
       </div> 
       
       <div class="center_content" style="background-color:#FFFFFF;">
       	<div class="left_content" style="width: 100%;height: 100%;">
       		<div class="crumb_nav">
            <a href="/aasimp/mok/maintenance/index_getMtInfo">home</a> &gt;&gt; 个人资料
            </div>
            <div class="title"><span class="title_icon"><img src="../../images/bullet1.gif" alt="" title="" /></span>
            <a name="a" id="infoa" href="javascript:void(0)" onclick="change('info')" style="text-decoration: underline">个人信息</a>
            <a name="a" id="companyinfoa" href="javascript:void(0)" onclick="change('companyinfo')" style="text-decoration:none">厂商信息完善</a>
            <a name="a" id="pwda" href="javascript:void(0)"  onclick="change('pwd')" style="text-decoration:none">密码管理</a>
            </div>
            <center>
            <div name="fom" class="feat_prod_box_details" id="info" style="display: block;">
            <p class="details">
            </p>
                 <form id="infoForm" action="/aasimp/mok/maintenance/info_updateInfo" method="post">
                 	<input name="username" value="${eauser.username}" style="display: none;">
                           
                    <div class="form_row" style="width: 345px">
                    <label class="contact" style="width: 78px"><strong>姓名：</strong></label>
                    <input value="${eauser.name }" name="name" id="info1" type="text" class="contact_input" style="width: 253px;" readonly/>
                    </div>  

                    <div class="form_row" style="width: 345px">
                    <label class="contact" style="width: 78px"><strong>手机：</strong></label>
                    <input value="${eauser.tel }" name="tel" id="info2" type="text" class="contact_input" style="width: 253px;" readonly/>
                    </div> 

                    <div class="form_row" style="width: 345px">
                    <label class="contact" style="width: 78px"><strong>邮箱：</strong></label>
                    <input value="${eauser.email }" name="email" id="info3" type="text" class="contact_input" style="width: 253px;" readonly/>
                    </div>

                    <div class="form_row" style="width: 345px">
                    <c:if test="${carMainInfo != null}">
	                    <label class="contact" style="width: 78px"><strong>车辆识别号：</strong></label>
	                    <c:forEach var="carMain" items="${carMainInfo}">
	                    	<input type="text" class="contact_input" style="width: 253px;" value="${carMain.vin}" readonly="readonly"/>
	                    </c:forEach>
                    </c:if>
                    </div>
                    
                    <div class="form_row"><span style="color: red;" id="message">${message }</span>
                    <input id="button1" type="button" class="register" value="修改" onclick="onupdate()"/>
                    </div>   
                  </form>
            </div>	
            
        	<div name="fom" class="feat_prod_box_details" id="companyinfo" style="display: none;">
            <p class="details">
            </p>
                 <form id="companyForm" action="/aasimp/mok/maintenance/info_updatecompany" method="post">    
                    <input name="username" value="${eauser.username}" style="display: none;">      
                    <div class="form_row">
                    <label class="contact"><strong>公司名称：</strong></label>
                    <input id="companyname" name="companyname" value="${companyInfo.companyName}" type="text" style="width: 253px;"/>
                    </div>  

                    <div class="form_row">
                    <label class="contact"><strong>公司地址：</strong></label>
                    <input id="companyadd" name="companyadd" value="${companyInfo.companyAdd}" type="text" style="width: 253px;"/>
                    </div> 

                    <div class="form_row">
                    <label class="contact"><strong>岗位：</strong></label>
                    <select style="width: 253px;" name="type" id="type">
                    	<c:if test="${companyInfo.type =='1' }">
    						<option selected="selected" value="1">负责人</option>
   					 	</c:if>
                    	<c:if test="${companyInfo.type !='1' }">
                    		<option value="1">负责人</option>
   				 		</c:if>
                    	<c:if test="${companyInfo.type =='2' }">
    						<option selected="selected" value="2">技术员</option>
   					 	</c:if>
                    	<c:if test="${companyInfo.type !='2' }">
                    		<option value="2">技术员</option>
   				 		</c:if>
                    </select>
                    </div>

                    <div class="form_row">
                    <input type="button" class="register" value="确认" onclick="updatecompany()"/>
                    </div>   
                  </form>
            </div>	
            
        	<div name="fom" class="feat_prod_box_details" id="pwd" style="display: none;">
            <p class="details">
            </p>
                 <form id="pwdForm" action="/aasimp/mok/maintenance/info_updatePwd" method="post">    
                    <input name="username" value="${eauser.username}" style="display: none;">      
                    <div class="form_row">
                    <label class="contact"><strong>旧密码：</strong></label>
                    <input id="pwd0" name="pwd0" type="password" style="width: 253px;"/>
                    </div>  

                    <div class="form_row">
                    <label class="contact"><strong>新密码：</strong></label>
                    <input id="pwd1" name="pwd1" type="password" style="width: 253px;"/>
                    </div> 

                    <div class="form_row">
                    <label class="contact"><strong>再次输入：</strong></label>
                    <input id="pwd2" name="pwd2" type="password" style="width: 253px;"/>
                    </div>

                    <div class="form_row">
                    <input type="button" class="register" value="确认" onclick="updatePwd()"/>
                    </div>   
                  </form>
            </div>	
            </center>
           
        <div class="clear"></div>
        </div><!--end of left content-->
        
       
       <div class="clear"></div>
       </div><!--end of center content-->
       <div class="footer">
       	<div class="left_footer"><img src="../../images/footer_logo.gif" alt="" title="" /><br /> </div>
        <div class="right_footer">
       
        </div>
        
       
       </div>
</div>
  </body>
</html>
